summaryrefslogtreecommitdiffstats
path: root/SetFlags.cmake
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2020-10-05 12:27:14 +0200
committerGitHub <noreply@github.com>2020-10-05 12:27:14 +0200
commita9031b6bae742b333b1b390192fa590f2ecb07ea (patch)
treeb2802c81d24d339c201a0747d66ba44e9ea8b1b0 /SetFlags.cmake
parentFixed current end generator (#4968) (diff)
downloadcuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.gz
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.bz2
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.lz
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.xz
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.tar.zst
cuberite-a9031b6bae742b333b1b390192fa590f2ecb07ea.zip
Diffstat (limited to 'SetFlags.cmake')
-rw-r--r--SetFlags.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/SetFlags.cmake b/SetFlags.cmake
index cf8cacd47..f5c8a282b 100644
--- a/SetFlags.cmake
+++ b/SetFlags.cmake
@@ -111,6 +111,14 @@ function(set_global_flags)
endif()
endfunction()
+function (try_add_flag TARGET FLAG)
+ include(CheckCXXCompilerFlag)
+ check_cxx_compiler_flag("${FLAG}" "HAS_FLAG_${FLAG}")
+ if ("${HAS_FLAG_${FLAG}}")
+ target_compile_options(${TARGET} PRIVATE "${FLAG}")
+ endif()
+endfunction()
+
function(set_exe_flags TARGET)
if (MSVC)
# TODO: MSVC level 4, warnings as errors
@@ -134,7 +142,7 @@ function(set_exe_flags TARGET)
-Wno-unused-parameter
)
- if(CMAKE_CXX_COMPILE_ID STREQUAL "Clang")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(
${TARGET} PRIVATE
@@ -155,5 +163,10 @@ function(set_exe_flags TARGET)
-Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro
-Wno-error=unused-command-line-argument
)
+
+ # We aren't using C++11
+ try_add_flag(${TARGET} -Wno-return-std-move-in-c++11)
+ # int to float conversions happen a lot, not worth fixing all warnings
+ try_add_flag(${TARGET} -Wno-implicit-int-float-conversion)
endif()
endfunction()